import { getCode } from '@/api/login'
import uuid from 'uuid/v4'
import { ValidationProvider ,ValidationObserver} from 'vee-validate'

export default{
    components:{
        ValidationProvider,
        ValidationObserver,
      },
      data(){
          return{
              code: '',
              svg: ''
          }
      },
      mounted () {
        let sid = ''
        if(localStorage.getItem('sid')){
          sid = localStorage.getItem('sid')
          
        }else{
          sid = uuid()
          localStorage.setItem('sid',sid)
        }
        this.$store.commit('setSid', sid)
        this._getCode()
      },
      methods:{
        _getCode () {
            let sid = this.$store.state.sid
            getCode(sid).then((res) =>{
              // console.log(sid);
              if(res.code === 200){
                this.svg = res.data
              }
            })
          }
      }
}